package com.mooc.lib_sofa.bind

import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mooc.lib_sofa.adapter.SofaFeedAdapter

class SofaRecyclerViewBind {

    companion object{
        @JvmStatic
        @BindingAdapter(value = ["sofaAdapter","scrollListener"])
        fun sofaRVBind(recyclerView : RecyclerView,sofaAdapter : SofaFeedAdapter,
                       scrollListener : RecyclerView.OnScrollListener){
            recyclerView.addOnScrollListener(scrollListener)
            var manager = LinearLayoutManager(recyclerView.context)
            manager.orientation=LinearLayoutManager.VERTICAL
            recyclerView.layoutManager = manager
            recyclerView.adapter = sofaAdapter
        }
    }

}